perm filename TEMP.XGP[HAL,HE] blob
sn#185823 filedate 1975-11-11 generic text, type T, neo UTF8
/FONT#0=BASL30[HAL, HE]/FONT#1=BASI30[HAL, HE]/FONT#2=BASB30/TMAR=200/PMAR=1992/BMAR=2
␈↓␈↓↓␈↓α␈↓ ↓H
␈↓ α,
␈↓ α,
␈↓ α,␈β↓H␈↓␈↓α␈↓ ∧y␈↓&THE COMPILE-TIME SYSTEM OF AL␈↓)β⊃␈↓ α,
␈↓ α,␈β↓f␈↓α␈↓ α,
␈↓ α,␈βα∧␈↓α␈↓ α,
␈↓ α,␈βα"␈↓α␈↓␈↓ α,The␈α∀compile-time␈α∀system␈α∀contains␈α∪world␈α∪modeling␈α∪information,␈α∪the␈α∪code-generator,␈α∪the␈↓ α,
␈↓ α,␈βα@␈↓␈↓ α,trajectory␈α
calculator,␈α
and␈α
the␈α
emitter.␈α
The␈α
world␈αmodeling␈αis␈αdescribed␈αelsewhere.␈αThe␈αcode␈↓ α,
␈↓ α,␈βα↑␈↓␈↓ α,generator␈α
and␈α
the␈α
trajectory␈α
calculator␈α
are␈α
described␈α
here.␈↓ α,
␈↓ α,␈βα|␈↓␈↓ α,
␈↓ α,␈ββ~␈↓␈↓↓␈↓ ¬uCODE GENERATOR␈↓ α,
␈↓ α,␈ββ8␈↓↓␈↓ α,
␈↓ α,␈ββV␈↓↓␈↓␈↓ α,The␈αprincipal␈αroutine␈αis␈αTSCAN,␈αwhich␈αgenerates␈αcode␈αfor␈αthe␈αroot␈αof␈αthe␈αbound␈αparse␈αtree␈↓ α,
␈↓ α,␈ββt␈↓␈↓ α,and␈α↔calls␈α↔itself␈α↔recursively␈α↔for␈α↔the␈α↔rest.␈α↔The␈α↔structures␈α↔in␈α↔this␈α↔tree␈α⊗are␈α⊗defined␈α⊗in␈↓ α,
␈↓ α,␈β∧∩␈↓␈↓ α,HALREC[HAL,RHT],␈α⊂page␈α⊂three.␈α⊂TSCAN␈α⊂is␈α⊂a␈α⊂large␈α⊂IF-THEN-ELSE-IF-THEN␈α∂chain␈↓ α,
␈↓ α,␈β∧0␈↓␈↓ α,which␈α∞determines␈α∞which␈α∞of␈α∞the␈α∞various␈α∞possible␈α∞structures␈α∞is␈α∞present.␈α
If␈α
it␈α
is␈α
some␈α
kind␈α
of␈↓ α,
␈↓ α,␈β∧N␈↓␈↓ α,statement,␈α∪then␈α∪appropriate␈α∪pseudo-code␈α∪is␈α∪emitted.␈α∪The␈α∪preparation␈α∪of␈α∪this␈α∩code␈α∩may␈↓ α,
␈↓ α,␈β∧l␈↓␈↓ α,require␈αthat␈αcode␈αfor␈αthe␈αevaluation␈αof␈αan␈αexpression.␈α
Such␈α
code␈α
is␈α
prepared␈α
in␈α
the␈α
recursive␈↓ α,
␈↓ α,␈β¬
␈↓␈↓ α,procedure␈αEMITEXPR,␈αwhich␈αperforms␈αtype-consistency␈αchecking␈α(but␈αnot␈αconstant␈α
folding,␈↓ α,
␈↓ α,␈β¬(␈↓␈↓ α,which␈α
could␈α
be␈α
done␈α
here).␈α
Code␈α
for␈α
boolean␈α
tests␈α
is␈α
prepared␈α
by␈α
EMITBOOL.␈↓ α,
␈↓ α,␈β¬F␈↓␈↓ α,
␈↓ α,␈β¬d␈↓␈↓↓␈↓ ¬7TRAJECTORY CALCULATOR␈↓ α,
␈↓ α,␈βεα␈↓↓␈↓ α,
␈↓ α,␈βε ␈↓↓␈↓␈↓ α,The␈αtrajectory␈αcalculator␈αturns␈αmotion␈αspecifications␈αinto␈αinterpretable␈αtables.␈αAt␈αthe␈α
moment␈↓ α,
␈↓ α,␈βε>␈↓␈↓ α,it␈α⊂allows␈α⊂any␈α⊂one␈α⊂mechanism,␈α⊂that␈α⊂is,␈α⊂one␈α∂arm␈α∂or␈α∂one␈α∂hand.␈α∂Future␈α∂work␈α∂will␈α∂allow␈α∂any␈↓ α,
␈↓ α,␈βε\␈↓␈↓ α,combination␈α
of␈α
mechanisms.␈α
The␈α
tables␈α
are␈α
calculated␈α
by␈α
the␈α
following␈α
method:␈↓ α,
␈↓ α,␈βεz␈↓␈↓ α,
␈↓ α|␈βπ_␈↓␈↓ α|A␈αthread␈αis␈αmade,␈αwith␈αa␈αnode␈αfor␈α
each␈α
place␈α
in␈α
the␈α
motion␈α
specification,␈α
that␈α
is,␈↓ α|
␈↓ α|␈βπ6␈↓␈↓ α|the␈α∞initial␈α
point,␈α
the␈α
departure,␈α
if␈α
any,␈α
the␈α
via␈α
points,␈α
the␈α
approach␈α
point,␈α
and␈↓ α|
␈↓ α|␈βπT␈↓␈↓ α|the␈α
destination.␈α
Arm␈α
or␈α
hand␈α
solutions␈α
are␈α
calculated␈α
for␈α
each␈α
node.␈αIt␈αmay␈αbe␈↓ α|
␈↓ α|␈βπr␈↓␈↓ α|that␈α∂this␈α∂serial␈α∂calculation␈α∂will␈α∂lead␈α∂to␈α∂flips␈α∂of␈α∂the␈α∂arm.␈α∞If␈α∞this␈α∞happens,␈α∞the␈↓ α|
␈↓ α|␈βλ⊂␈↓␈↓ α|proper␈α∪order␈α∩is␈α∩outside-in.␈α∩This␈α∩is␈α∩because␈α∩the␈α∩ARMSOL␈α∩routine␈α∩uses␈α∩the␈↓ α|
␈↓ α|␈βλ.␈↓␈↓ α|previous␈α
solution␈α
to␈α
resolve␈α
ambiguities␈α
in␈α
joint␈α
4␈α
of␈α
the␈α
Scheinman␈α
arms.␈↓ α|
␈↓ α,␈βλL␈↓␈↓ α,␈↓ α,
␈↓ α|␈βλj␈↓␈↓ α|Any␈α⊃deproach␈α⊃points␈α⊂or␈α⊂calculated␈α⊂via␈α⊂points␈α⊂or␈α⊂calculated␈α⊂destinations␈α⊂must␈↓ α|
␈↓ α|␈β λ␈↓␈↓ α|have␈αcode␈αemitted␈αto␈αmake␈αa␈αcell␈αfor␈αthem␈αin␈αthe␈αgraph␈αstructure.␈αThe␈αcell␈αfor␈αa␈↓ α|
␈↓ α|␈β &␈↓␈↓ α|departure␈α∞is␈α∞marked␈α∞permanently␈α∞invalid.␈α∞Its␈α∞calculator␈α
uses␈α
the␈α
hand␈α
position␈↓ α|
␈↓ α|␈β D␈↓␈↓ α|itself,␈αnot␈αthe␈αplace␈αwhere␈αthe␈αarm␈αwas␈αto␈αbe␈αat␈αthe␈α
start␈α
of␈α
the␈α
motion.␈α
The␈α
cells␈↓ α|
␈↓ α|␈β b␈↓␈↓ α|for␈αthe␈αcalculated␈αvia␈αpoints␈αand␈αthe␈αapproach␈αpoint␈αare␈αin␈αthe␈αgraph␈αstructure␈↓ α|
␈↓ α|␈β
␈↓␈↓ α|in␈αthe␈αusual␈α
way.␈α
This␈α
code␈α
must␈α
be␈α
emmitted␈α
at␈α
the␈α
outermost␈α
practical␈α
point␈α
in␈↓ α|
␈↓ α|␈β
≡␈↓␈↓ α|the␈αprogram:␈αIf␈αit␈αis␈αtoo␈αfar␈αin,␈αthen␈αit␈αgets␈αredone␈αtoo␈αoften,␈αand␈αif␈αit␈αis␈αtoo␈αfar␈↓ α|
␈↓ α|␈β
<␈↓␈↓ α|out,␈α∂it␈α∂might␈α∂cause␈α∂graph␈α∂structure␈α∞to␈α∞hang␈α∞around␈α∞associated␈α∞to␈α∞non-existent␈↓ α|
␈↓ α|␈β
Z␈↓␈↓ α|nodes.␈α
In␈α
any␈α
case,␈α
it␈α
is␈α
necessary␈α
to␈α
put␈α
such␈α
code␈α
at␈α
a␈α
block␈α
entry,␈α
and␈α
to␈α
be␈↓ α|
␈↓ α|␈β
x␈↓␈↓ α|sure␈α∞to␈α
get␈α
rid␈α
of␈α
the␈α
resulting␈α
graph␈α
structure␈α
at␈α
block␈α
exit.␈α
The␈α
current␈α
code␈↓ α|
␈↓ α|␈β⊗␈↓␈↓ α|does␈α
not␈α
handle␈α
any␈α
of␈α
this.␈↓ α|
␈↓ α,␈β4␈↓␈↓ α,␈↓ α,
␈↓ α|␈βR␈↓␈↓ α|At␈αthis␈α
time,␈α
the␈α
fourth␈α
degree␈α
polynomials␈α
for␈α
deproach␈α
segments␈α
are␈α
calculated,␈↓ α|
␈↓ α|␈βp␈↓␈↓ α|and␈α⊗any␈α⊗given␈α∃velocity␈α∃constraints␈α∃are␈α∃noted.␈α∃The␈α∃presence␈α∃of␈α∃a␈α∃velocity␈↓ α|
␈↓ α|␈β∞␈↓␈↓ α|constraint␈α⊂implies␈α⊂that␈α⊂the␈α∂acceleration␈α∂is␈α∂constrained␈α∂to␈α∂zero.␈α∂If␈α∂the␈α∂user␈α∂has␈↓ α|
␈↓ α|␈β,␈↓␈↓ α|supplied␈αa␈αtime,␈αit␈αis␈αput␈αin␈αUTIME,␈αand␈αSTIME␈αis␈αcomputed␈αby␈αthe␈αsystem.␈αIf␈↓ α|
␈↓ α|␈βJ␈↓␈↓ α|they␈αare␈αcompatible,␈αSTIME␈αis␈α
modified␈α
to␈α
the␈α
final␈α
decision␈α
on␈α
the␈α
time␈α
for␈α
the␈↓ α|
␈↓ α|␈βh␈↓␈↓ α|segment.␈↓ α|
␈↓ α,␈β
ε␈↓␈↓ α,␈↓ α,
␈↓ α|␈β
$␈↓␈↓ α|After␈αthe␈αentire␈αthread␈αis␈αmade,␈αa␈αglobal␈αcheck␈αis␈αmade␈αto␈α
insure␈α
that␈α
the␈α
timing␈↓ α|
␈↓ α|␈β
B␈↓␈↓ α|is␈αin␈αagreement␈αwith␈αthe␈αuser's␈αwishes.␈αThen␈αthe␈αthread␈αis␈αdivided␈αinto␈αchunks,␈↓ α|
␈↓ α|␈β
`␈↓␈↓ α|where␈α⊃each␈α⊂chunk␈α⊂is␈α⊂the␈α⊂region␈α⊂between␈α⊂two␈α⊂velocity-constrained␈α⊂points␈α⊂(the␈↓ α|
␈↓ α|␈β
}␈↓␈↓ α|deproach␈α∩points␈α∩are␈α∩such).␈α∩A␈α∩chunk␈α∩which␈α∩has␈α∩only␈α∩two␈α∩points␈α⊃(but␈α⊃not␈α⊃a␈↓ α|
␈↓ α|␈β∞≤␈↓␈↓ α|deproach␈α⊂chunk,␈α⊂for␈α⊂which␈α⊂the␈α⊂trajectory␈α⊂has␈α∂already␈α∂been␈α∂calculated)␈α∂gets␈α∂a␈↓ α|
␈↓ α|␈β∞:␈↓␈↓ α|fifth-degree␈α⊂polynomial␈α⊂calculated␈α∂to␈α∂match␈α∂all␈α∂the␈α∂constraints.␈α∂A␈α∂chunk␈α∂with␈↓ α|
␈↓ α|␈β∞X␈↓␈↓ α|more␈α
points␈α
requires␈α
splining␈α
for␈α
the␈α
trajectory.␈α
The␈αfirst␈αstep␈αis␈αto␈αinsert␈αone␈↓ α|
␈↓ α|␈β∞v␈↓␈↓ α|unconstrained␈αpoint␈αin␈αeach␈αof␈αthe␈αtwo␈αlongest␈αintervals.␈αIt␈αhas␈αbeen␈αfound␈αthat␈↓ α|
␈↓ α|␈β∂∀␈↓␈↓ α|the␈αbest␈αplace␈αfor␈αthese␈αpoints␈αis␈αalmost␈αat␈αthe␈αvery␈αend␈αof␈αthe␈αintervals␈α(.999␈αof␈↓ α|
␈↓ α|␈β∂2␈↓␈↓ α|the␈α≠way␈α~to␈α~the␈α~end)␈α~to␈α~minimise␈α~overshoot␈α~problems.␈α~After␈α~the␈α~fully␈↓ α|
␈↓ εW␈β∂l␈↓---1---
␈↓ α|␈β↓H␈↓␈↓ α|unconstrained␈α∞nodes␈α∞have␈α∞been␈α∞inserted␈α∞into␈α∞the␈α∞thread,␈α∞the␈α∞routine␈α
POLY␈α
is␈↓ α|
␈↓ α|␈β↓f␈↓␈↓ α|called␈α∂to␈α∂create␈α∂the␈α∂coefficients␈α∂of␈α∂the␈α∂third␈α∂degree␈α∂splined␈α∂polynomial.␈α∂It␈α∞has␈↓ α|
␈↓ α|␈βα∧␈↓␈↓ α|been␈αfound␈αthat␈αusing␈αfourth␈αdegree␈αpolynomials␈αin␈αtwo␈αof␈αthe␈αsegments␈αinstead␈↓ α|
␈↓ α|␈βα"␈↓␈↓ α|of␈α
inserting␈α
two␈α
unconstrained␈αpoints␈αleads␈αto␈αuncontrollable␈αovershoot.␈αFinally,␈↓ α|
␈↓ α|␈βα@␈↓␈↓ α|the␈α
resulting␈α
trajectory␈α
is␈α
emitted.␈↓ α|
␈↓ α,␈βα↑␈↓␈↓ α,␈↓ α,
␈↓ α,␈βα|␈↓␈↓ α,The␈αfollowing␈αconventions␈αare␈αused␈αfor␈αarms␈αand␈αjoints.␈αJoints␈α1-6␈αare␈αyellow␈αarm␈α(arm␈α0),␈↓ α,
␈↓ α,␈ββ~␈↓␈↓ α,and␈αjoint␈α7␈αis␈αthe␈αyellow␈αfingers␈α(arm␈α2).␈αJoints␈α8-13␈αare␈αthe␈αblue␈αarm␈α(arm␈α1),␈αand␈αjoint␈α14␈↓ α,
␈↓ α,␈ββ8␈↓␈↓ α,is␈αthe␈αblue␈αfingers␈α(arm␈α3).␈α
The␈α
angle␈α
arrays␈α
are␈α
tailored␈α
to␈α
have␈α
whatever␈α
joints␈α
are␈α
needed.␈↓ α,
␈↓ α,␈ββV␈↓␈↓ α,The␈α
arm␈α
and␈α
hand␈α
solution␈α
programs␈α
are␈α
told␈α
which␈α
mechanism␈α
to␈α
expect.␈↓ α,
␈↓ α,␈ββt␈↓␈↓ α,
␈↓ α,␈β∧∩␈↓␈↓ α,The␈αcurrent␈αcode␈αdoes␈αnot␈αcheck␈αlocation,␈αvelocity␈αor␈αacceleration␈αbounds␈αexcept␈αfor␈αlocation␈↓ α,
␈↓ α,␈β∧0␈↓␈↓ α,bounds␈αat␈αuser-specified␈αplaces.␈αInstead,␈αlocation␈αbounds␈αare␈αto␈αa␈αlarge␈αextent␈α
insured␈α
by␈α
the␈↓ α,
␈↓ α,␈β∧N␈↓␈↓ α,servo.␈α∞Velocity␈α∞and␈α∞acceleration␈α∞can␈α∞be␈α∞optimized␈α∞by␈α∞rescaling␈α∞time,␈α
in␈α
the␈α
cases␈α
when␈α
the␈↓ α,
␈↓ α,␈β∧l␈↓␈↓ α,user␈α⊃has␈α⊃not␈α⊃specified␈α⊃any␈α⊃time␈α⊃in␈α⊂the␈α⊂entire␈α⊂motion,␈α⊂nor␈α⊂any␈α⊂velocities,␈α⊂but␈α⊂this␈α⊂is␈α⊂not␈↓ α,
␈↓ α,␈β¬
␈↓␈↓ α,currently␈α
attempted.␈↓ α,
␈↓ α,␈β¬(␈↓␈↓ α,
␈↓ α,␈β¬F␈↓␈↓↓␈↓ ε@EMITTER␈↓ α,
␈↓ α,␈β¬d␈↓↓␈↓ α,
␈↓ α,␈βεα␈↓↓␈↓␈↓ α,All␈αcode␈αemission␈αis␈αdone␈αthrough␈αthe␈αroutine␈αEMIT␈αwhich␈α
takes␈α
arguments␈α
specifying␈α
what␈↓ α,
␈↓ α,␈βε ␈↓␈↓ α,output␈α∂file␈α∂to␈α∂use␈α∂(e.g.,␈α∂pseudo-code␈α∞or␈α∞constant␈α∞area),␈α∞the␈α∞data␈α∞to␈α∞output,␈α∞and␈α∞whether␈α∞to␈↓ α,
␈↓ α,␈βε>␈↓␈↓ α,treat␈α
it␈α
as␈αan␈αinstruction,␈αan␈αoctal␈αconstant,␈αa␈αlabel␈αdeclaration,␈αor␈αrepeatedly␈αto␈αproduce␈αthe␈↓ α,
␈↓ α,␈βε\␈↓␈↓ α,rel␈α
file.␈↓ α,
␈↓ εW␈β∂l␈↓---2---
␈↓ α,␈β↓H␈↓␈↓α␈↓ ¬"␈↓&THE RUNTIME SYSTEM OF AL␈↓)β⊃␈↓ α,
␈↓ α,␈β↓f␈↓α␈↓ α,
␈↓ α,␈βα∧␈↓α␈↓ α,
␈↓ α,␈βα"␈↓α␈↓␈↓ α,The␈αruntime␈αsystem␈αof␈αAL␈αconsists␈αof␈αseveral␈αmodules.␈αThese␈αare␈αthe␈αkernel,␈αthe␈αinterpreter,␈↓ α,
␈↓ α,␈βα@␈↓␈↓ α,the␈α⊃control␈α⊃code,␈α⊃and␈α⊃the␈α⊃debugger.␈α⊃The␈α⊃kernel␈α⊃was␈α⊃implemented␈α⊃by␈α⊃Botond␈α⊃Eross,␈α⊂the␈↓ α,
␈↓ α,␈βα↑␈↓␈↓ α,interpreter␈αby␈αRaphael␈αFinkel,␈αthe␈αcontrol␈αcode␈αby␈αBruce␈αShimano,␈αand␈αthe␈αdebugger,␈αDDT,␈↓ α,
␈↓ α,␈βα|␈↓␈↓ α,by␈α
Jeff␈α
Rubin.␈α
These␈α
modules␈α
will␈α
be␈α
discussed␈α
in␈α
order.␈↓ α,
␈↓ α,␈ββ~␈↓␈↓ α,
␈↓ εW␈β∂l␈↓---3---
␈↓ α,␈β↓H␈↓␈↓↓␈↓ ε≡THE KERNEL␈↓ α,
␈↓ α,␈β↓f␈↓↓␈↓ α,
␈↓ α,␈βα∧␈↓↓␈↓␈↓ α,The␈αkernel␈αresides␈αin␈αlow␈αcore␈α(0␈αto␈α13777)␈αof␈αthe␈αPDP11␈α(here␈αafter␈αcalled␈αthe␈αELF).␈αWhen␈↓ α,
␈↓ α,␈βα"␈↓␈↓ α,it␈αis␈αstarted␈αat␈αlocation␈α1000,␈αit␈αfinds␈αthe␈αuser's␈αstarting␈αaddress␈αat␈α13776␈α
and␈α
a␈α
pointer␈α
to␈α
his␈↓ α,
␈↓ α,␈βα@␈↓␈↓ α,processor␈α⊂control␈α⊂block␈α⊂at␈α⊂13777.␈α⊂When␈α⊂the␈α⊂AL␈α⊂system␈α∂is␈α∂the␈α∂"user",␈α∂it␈α∂is␈α∂the␈α∂interpreter␈↓ α,
␈↓ α,␈βα↑␈↓␈↓ α,initialization␈α∞code␈α∞that␈α∞is␈α∞pointed␈α∞to␈α∞by␈α∞these␈α∞words.␈α∞Control␈α∞is␈α∞passed␈α∞to␈α∞the␈α
user␈α
(in␈α
cpu␈↓ α,
␈↓ α,␈βα|␈↓␈↓ α,user␈α
mode).␈↓ α,
␈↓ α,␈ββ~␈↓␈↓ α,
␈↓ α,␈ββ8␈↓␈↓ α,Processes␈α∂communicate␈α∂with␈α∂the␈α∂kernel␈α∂by␈α∞means␈α∞of␈α∞the␈α∞EMT␈α∞(emulator␈α∞trap)␈α∞instruction.␈↓ α,
␈↓ α,␈ββV␈↓␈↓ α,Mechanisms␈α
are␈α
provided␈α
to␈αcontrol␈αmultiple␈αprocesses,␈αincluding␈αscheduling␈αin␈αa␈αtime-slice␈↓ α,
␈↓ α,␈ββt␈↓␈↓ α,environment,␈α
assignment␈α
of␈α
priorities,␈α
an␈α
event␈αmechanism␈αwith␈αsignal␈αand␈αwait␈αprimitives.␈↓ α,
␈↓ α,␈β∧∩␈↓␈↓ α,All␈αsystem␈αcalls␈αpop␈αtheir␈αarguments␈αoff␈αthe␈αUser␈αstack␈αand␈αpush␈αtheir␈αreturn␈αvalues␈αif␈αthey␈↓ α,
␈↓ α,␈β∧0␈↓␈↓ α,have␈αany.␈αThey␈αmostly␈αreturn␈αwith␈αthe␈αC␈αcondition␈αcode␈αbit␈αzero.␈αAn␈αerror␈αcondition␈αcauses␈↓ α,
␈↓ α,␈β∧N␈↓␈↓ α,a␈α⊂return␈α⊂with␈α⊂C=1;␈α⊂in␈α∂that␈α∂case,␈α∂the␈α∂arguments␈α∂have␈α∂been␈α∂popped␈α∂and␈α∂no␈α∂return␈α∂values␈↓ α,
␈↓ α,␈β∧l␈↓␈↓ α,pushed.␈↓ α,
␈↓ α,␈β¬
␈↓␈↓ α,
␈↓ α,␈β¬(␈↓␈↓ α,The␈αbasic␈αtime␈αquantum␈αin␈αthe␈αkernel␈αis␈αcurrently␈α2␈αmilliseconds,␈αalthough␈αit␈αwill␈αeventually␈↓ α,
␈↓ α,␈β¬F␈↓␈↓ α,be␈αrun␈αat␈α1␈αmillisecond.␈αProcesses␈αcan␈αrequest␈αto␈αsleep␈αfor␈αa␈αnumber␈αof␈αquanta.␈αAt␈αthe␈αstart␈↓ α,
␈↓ α,␈β¬d␈↓␈↓ α,of␈α
each␈α
quantum,␈α
all␈α
processes␈α
which␈α
are␈α
scheduled␈α
for␈α
execution␈α
are␈α
readied,␈α
and␈α
those␈α
with␈↓ α,
␈↓ α,␈βεα␈↓␈↓ α,higher␈α
priority␈α
have␈α
precedence.␈α
Any␈α
unused␈α
time␈α
is␈α
soaked␈α
up␈α
by␈α
the␈α
null␈α
job.␈↓ α,
␈↓ α,␈βε ␈↓␈↓ α,
␈↓ α,␈βε>␈↓␈↓ α,Level␈α7␈αis␈αthe␈αhighest␈αpriority.␈αThis␈αlevel␈αis␈αonly␈αused␈αfor␈αcritical␈αoperations␈αsuch␈αas␈αreading␈↓ α,
␈↓ α,␈βε\␈↓␈↓ α,the␈α
analog-to-digital␈α
converter␈α
(ADC)␈α
and␈α
servoing␈α
device␈α
joints.␈α
Only␈α
one␈α
level␈α7␈αprocess␈↓ α,
␈↓ α,␈βεz␈↓␈↓ α,can␈α
be␈α
scheduled␈α
for␈α
any␈α
given␈α
time␈α
slot.␈α
When␈α
the␈α
Kernel␈α
starts␈α
a␈α
level␈α7␈αjob␈αrunning,␈αit␈↓ α,
␈↓ α,␈βπ_␈↓␈↓ α,interprets␈α
the␈αcontents␈αof␈αUser␈αregisters␈α3␈αand␈α4␈αin␈αthe␈αPDB␈αas␈αpointers␈αto␈αtwo␈αdata␈αarrays.␈↓ α,
␈↓ α,␈βπ6␈↓␈↓ α,R3␈α⊃points␈α⊃at␈α⊃a␈α⊃list␈α⊃of␈α⊃ADC␈α⊃channel␈α⊃numbers␈α⊃(one␈α⊃per␈α⊃word)␈α⊃terminated␈α⊃by␈α⊂a␈α⊂negative␈↓ α,
␈↓ α,␈βπT␈↓␈↓ α,number.␈α⊂The␈α⊂startup␈α⊂routine␈α∂reads␈α∂all␈α∂the␈α∂channels␈α∂specified␈α∂in␈α∂the␈α∂array␈α∂and␈α∂puts␈α∂the␈↓ α,
␈↓ α,␈βπr␈↓␈↓ α,results␈αinto␈αthe␈αcorresponding␈α
locations␈α
in␈α
the␈α
array␈α
that␈α
R4␈α
points␈α
at.␈α
When␈α
the␈α
user␈α
process␈↓ α,
␈↓ α,␈βλ⊂␈↓␈↓ α,gets␈α∞control,␈α∞R3␈α∞and␈α∞R4␈α∞point␈α
at␈α
the␈α
first␈α
words␈α
of␈α
the␈α
two␈α
arrays␈α
and␈α
all␈α
of␈α
the␈α
channels␈↓ α,
␈↓ α,␈βλ.␈↓␈↓ α,have␈α⊂been␈α⊂read.␈α⊂The␈α⊂recommended␈α⊂way␈α⊂for␈α⊂a␈α⊂level␈α∂7␈α∂job␈α∂to␈α∂reschedule␈α∂itself␈α∂is␈α∂to␈α∂do␈α∂a␈↓ α,
␈↓ α,␈βλL␈↓␈↓ α,SCHED7␈αto␈αits␈αown␈αPDB,␈αtake␈αnote␈αof␈αthe␈αreturned␈αactual␈αtime␈αinterval,␈αand␈αthen␈αDISMIS␈↓ α,
␈↓ α,␈βλj␈↓␈↓ α,(details␈αbelow).␈αThis␈αprocedure␈α
minimizes␈α
overhead␈α
by␈α
not␈α
saving␈α
and␈α
restoring␈α
the␈α
registers.␈↓ α,
␈↓ α,␈β λ␈↓␈↓ α,NOTE:␈αSince␈αlevel␈α7␈αcan␈αnot␈αbe␈αinterrupted␈α(even␈αby␈αfloating-point␈αtraps),␈αI␈αdon't␈αbother␈αto␈↓ α,
␈↓ α,␈β &␈↓␈↓ α,allocate␈α
PDB␈α
space␈α
for␈α
any␈α
of␈α
the␈α
floating-point␈α
stuff.␈↓ α,
␈↓ α,␈β D␈↓␈↓ α,
␈↓ α,␈β b␈↓A description of each of the system calls follows.␈↓ α,
␈↓ α,␈β
␈↓␈↓ α,
␈↓ α,␈β
≡␈↓DISMIS (no arguments)␈↓ α,
␈↓ α,␈β
<␈↓␈↓ α,
␈↓ α,␈β
Z␈↓␈↓ α,Kills␈αthe␈αprocess␈αthat␈αuses␈αit.␈αIt␈αsaves␈αthe␈αPC,␈αPSW,␈αand␈αSP␈αbut␈αnothing␈αelse.␈αIf␈αthe␈αprocess␈↓ α,
␈↓ α,␈β
x␈↓␈↓ α,is␈α
restarted␈α
(as␈α
in␈α
the␈α
level␈α
7␈α
SCHED7-DISMIS␈α
sequence)␈αit␈αwill␈αresume␈αafter␈αthe␈αDISMIS␈↓ α,
␈↓ α,␈β⊗␈↓␈↓ α,with␈αthe␈αstack␈αin␈αthe␈αright␈αstate␈αbut␈αall␈αregisters␈αclobbered.␈αR3␈αthrough␈αR5␈αwill␈αbe␈αreloaded␈↓ α,
␈↓ α,␈β4␈↓␈↓ α,with␈α
what␈α
they␈α
had␈α
at␈α
the␈α
first␈α
startup.␈↓ α,
␈↓ α,␈βR␈↓␈↓ α,
␈↓ α,␈βp␈↓␈↓ α,
␈↓ α,␈β∞␈↓FORK PDB,LOC,PRI␈↓ α,
␈↓ α,␈β,␈↓␈↓ α,
␈↓ α,␈βJ␈↓␈↓ α,Starts␈αup␈αa␈αnew␈αprocess␈α
immediately.␈α
PDB␈α
points␈α
at␈α
a␈α
process␈α
descriptor,␈α
LOC␈α
is␈α
the␈α
starting␈↓ α,
␈↓ α,␈βh␈↓␈↓ α,address,␈αand␈αPRI␈αis␈αthe␈αpriority␈αof␈αthe␈αnew␈αprocess.␈αIf␈αPRI␈αis␈αhigher␈αthan␈αthat␈α
of␈α
the␈α
calling␈↓ α,
␈↓ α,␈β
ε␈↓␈↓ α,process␈α∞the␈α∞new␈α∞one␈α∞will␈α∞run␈α∞immediately␈α∞and␈α∞pre-empt␈α∞the␈α∞caller.␈α
FORKing␈α
with␈α
PRI=7␈↓ α,
␈↓ α,␈β
$␈↓␈↓ α,will␈αwork␈αbut␈αis␈αnot␈αa␈αgood␈αidea␈αsince␈αif␈αyou␈αdo␈αit␈αtoo␈αlate␈αin␈αa␈αclock␈αperiod␈αthe␈αclock␈αmight␈↓ α,
␈↓ α,␈β
B␈↓␈↓ α,miss␈α
a␈α
tick.␈↓ α,
␈↓ α,␈β
`␈↓␈↓ α,
␈↓ α,␈β
}␈↓␈↓ α,
␈↓ εW␈β∂l␈↓---4---
␈↓ α,␈β↓H␈↓SCHEDU PDB,LOC,PRI,TIME␈↓ α,
␈↓ α,␈β↓f␈↓␈↓ α,
␈↓ α,␈βα∧␈↓␈↓ α,Works␈αjust␈αlike␈αFORK␈αexcept␈αthat␈αinstead␈αof␈αstarting␈αthe␈αtarget␈αprocess␈αimmediately␈αit␈αputs␈↓ α,
␈↓ α,␈βα"␈↓␈↓ α,the␈α∂process␈α∂on␈α∂the␈α∂clock␈α∂queue␈α∂to␈α∂start␈α∂up␈α∂(TIME)␈α∂milliseconds␈α∂from␈α∞now.␈α∞This␈α∞will␈α∞also␈↓ α,
␈↓ α,␈βα@␈↓␈↓ α,work␈αif␈αPRI=7,␈αbut␈αif␈αanother␈αlevel␈α7␈αprocess␈αis␈αalready␈αscheduled␈αfor␈αthat␈αslot␈αthe␈αnew␈αone␈↓ α,
␈↓ α,␈βα↑␈↓␈↓ α,will␈α
be␈α
put␈α
into␈α
the␈α
queue␈α
in␈α
the␈α
first␈α
available␈α
slot␈α
after␈α
the␈α
one␈α
you␈α
requested.␈↓ α,
␈↓ α,␈βα|␈↓␈↓ α,
␈↓ α,␈ββ~␈↓␈↓ α,
␈↓ α,␈ββ8␈↓SCHED7 ARRAY,TIME␈↓ α,
␈↓ α,␈ββV␈↓␈↓ α,
␈↓ α,␈ββt␈↓␈↓ α,Is␈αa␈αspecial␈αvariation␈αon␈αSCHEDU␈αto␈αallow␈αscheduling␈αa␈αwhole␈αbunch␈αof␈αpriority␈α7␈αjobs␈αat␈↓ α,
␈↓ α,␈β∧∩␈↓␈↓ α,one␈α∂whack.␈α∂ARRAY␈α∂points␈α∂at␈α∞(what␈α∞else)␈α∞which␈α∞consists␈α∞of␈α∞a␈α∞pointer␈α∞to␈α∞a␈α∞PDB,␈α∞a␈α∞return␈↓ α,
␈↓ α,␈β∧0␈↓␈↓ α,value,␈α∞another␈α∞PDB␈α∞pointer,␈α
another␈α
return␈α
value,␈α
etc.,␈α
ending␈α
with␈α
a␈α
zero␈α
where␈α
the␈α
next␈↓ α,
␈↓ α,␈β∧N␈↓␈↓ α,PDB␈αpointer␈αshould␈αbe.␈αTIME␈αis␈αthe␈αnumber␈αof␈αmilliseconds␈α
from␈α
now␈α
that␈α
the␈α
first␈α
process␈↓ α,
␈↓ α,␈β∧l␈↓␈↓ α,should␈α
start␈αup.␈αSCHED7␈αputs␈αthe␈αprocesses␈αinto␈αconsecutive␈αtime␈αslots␈αif␈αit␈αcan.␈αIf␈αa␈αslot␈αis␈↓ α,
␈↓ α,␈β¬
␈↓␈↓ α,already␈α⊂filled,␈α⊂it␈α⊂uses␈α∂the␈α∂next␈α∂available␈α∂one.␈α∂In␈α∂any␈α∂case,␈α∂it␈α∂returns␈α∂for␈α∂each␈α∂process␈α∂the␈↓ α,
␈↓ α,␈β¬(␈↓␈↓ α,number␈α
of␈α
number␈α
of␈α
milliseconds␈α
from␈α
now␈α
that␈α
it␈α
wound␈α
up␈α
being␈α
scheduled.␈↓ α,
␈↓ α,␈β¬F␈↓␈↓ α,
␈↓ α,␈β¬d␈↓␈↓ α,
␈↓ α,␈βεα␈↓SLEEP TIME␈↓ α,
␈↓ α,␈βε ␈↓␈↓ α,
␈↓ α,␈βε>␈↓␈↓ α,Puts␈α∀the␈α∪requesting␈α∪process␈α∪to␈α∪sleep␈α∪for␈α∪(TIME)␈α∪milliseconds.␈α∪If␈α∪TIME=0,␈α∪this␈α∪merely␈↓ α,
␈↓ α,␈βε\␈↓␈↓ α,reschedules␈αyou␈αfor␈αthe␈αpresent␈αtime␈αslot.␈αIf␈αyour␈αpriority␈αis␈α7␈αand␈αthe␈αtime␈αyou␈αrequested␈αis␈↓ α,
␈↓ α,␈βεz␈↓␈↓ α,taken,␈α
you␈α
will␈α
be␈α
scheduled␈α
in␈α
the␈α
first␈α
later␈α
available␈α
slot.␈↓ α,
␈↓ α,␈βπ_␈↓␈↓ α,
␈↓ α,␈βπ6␈↓␈↓ α,
␈↓ α,␈βπT␈↓EVMAK (no args)␈↓ α,
␈↓ εW␈β∂l␈↓---5---
␈↓ α,␈β↓H␈↓␈↓ α,
␈↓ α,␈β↓f␈↓␈↓ α,Creates␈α∞an␈α
event␈α
with␈α
its␈α
associated␈α
counter␈α
and␈α
empty␈α
queue␈α
of␈α
jobs␈α
waiting.␈α
It␈α
returns␈α
a␈↓ α,
␈↓ α,␈βα∧␈↓␈↓ α,unique␈α
identifier␈α
which␈αyou␈αcan␈αuse␈αlater␈αto␈αrefer␈αto␈αthe␈αevent.␈αEvents␈αcome␈αin␈αtwo␈αflavors:␈↓ α,
␈↓ α,␈βα"␈↓␈↓ α,the␈α∃kind␈α∃you␈α∃create␈α∀with␈α∀this␈α∀operation,␈α∀and␈α∀"permanent"␈α∀ones␈α∀that␈α∀reflect␈α∀hardware␈↓ α,
␈↓ α,␈βα@␈↓␈↓ α,conditions.␈αPermanent␈αevents␈αare␈αidentified␈αby␈αsmall␈αintegers.␈αI'll␈αadd␈αtheir␈αdescriptions␈αand␈↓ α,
␈↓ α,␈βα↑␈↓␈↓ α,identifiers␈α
as␈α
I␈α
add␈α
the␈α
events.␈↓ α,
␈↓ α,␈βα|␈↓␈↓ α,
␈↓ α,␈ββ~␈↓␈↓ α,
␈↓ α,␈ββ8␈↓EVKIL <event id>␈↓ α,
␈↓ α,␈ββV␈↓␈↓ α,
␈↓ α,␈ββt␈↓␈↓ α,Destroys␈α
the␈α
event␈α
if␈αit␈αwas␈αone␈αthat␈αyou␈αcreated,␈αwaking␈αup␈αany␈αprocesses␈αthat␈αare␈αwaiting␈↓ α,
␈↓ α,␈β∧∩␈↓␈↓ α,and␈α∪giving␈α∪them␈α∪the␈α∪C=1␈α∪return.␈α∪If␈α∪the␈α∪id␈α∪doesn't␈α∪point␈α∩at␈α∩an␈α∩event,␈α∩or␈α∩points␈α∩to␈α∩a␈↓ α,
␈↓ α,␈β∧0␈↓␈↓ α,permanent␈α
event,␈α
EVKIL␈α
does␈α
nothing␈α
and␈α
gives␈α
the␈α
error␈α
return.␈↓ α,
␈↓ α,␈β∧N␈↓␈↓ α,
␈↓ α,␈β∧l␈↓␈↓ α,
␈↓ α,␈β¬
␈↓EVSIG <event id>␈↓ α,
␈↓ α,␈β¬(␈↓␈↓ α,
␈↓ α,␈β¬F␈↓␈↓ α,Signals␈α⊂the␈α⊂event.␈α⊂If␈α⊂any␈α⊂processes␈α⊂are␈α⊂waiting,␈α⊂the␈α⊂first␈α⊂one␈α⊂will␈α⊂wake␈α⊂up.␈α∂EVSIG␈α∂of␈α∂a␈↓ α,
␈↓ α,␈β¬d␈↓␈↓ α,permanent␈α
event␈α
does␈α
nothing␈α
but␈α
give␈α
the␈α
error␈α
return.␈↓ α,
␈↓ α,␈βεα␈↓␈↓ α,
␈↓ α,␈βε ␈↓␈↓ α,
␈↓ α,␈βε>␈↓EVWAIT <event id>␈↓ α,
␈↓ α,␈βε\␈↓␈↓ α,
␈↓ α,␈βεz␈↓␈↓ α,Tests␈αthe␈αevent␈α(of␈αeither␈αtype)␈αand␈αmakes␈αthe␈αnormal␈αreturn␈αif␈αit␈αhas␈αhappened.␈αIf␈αit␈αhasn't␈↓ α,
␈↓ α,␈βπ_␈↓␈↓ α,happened,␈αyour␈αprocess␈αgoes␈αto␈αsleep␈αwaiting␈αfor␈αit␈αand␈αgets␈αthe␈αnormal␈αreturn␈αwhen␈αit␈αdoes␈↓ α,
␈↓ α,␈βπ6␈↓␈↓ α,happen.␈αIf␈αit␈αis␈αnot␈αan␈αevent,␈αor␈αit␈αhas␈αbeen␈αEVKILled␈αwhile␈αyou␈αwere␈αwaiting,␈αyou␈αget␈αthe␈↓ α,
␈↓ α,␈βπT␈↓␈↓ α,error␈α
return.␈α
The␈α
queue␈αof␈αjobs␈αwaiting␈αon␈αan␈αevent␈αis␈αordered␈αby␈αtheir␈αnominal␈αpriorities,␈↓ α,
␈↓ α,␈βπr␈↓␈↓ α,first␈α
come␈α
first␈α
served␈α
within␈α
priority␈α
levels.␈↓ α,
␈↓ α,␈βλ⊂␈↓␈↓ α,
␈↓ α,␈βλ.␈↓␈↓ α,
␈↓ α,␈βλL␈↓EVTST <event id>␈↓ α,
␈↓ α,␈βλj␈↓␈↓ α,
␈↓ α,␈β λ␈↓␈↓ α,Tests␈α
the␈α
event␈α
and␈α
returns␈α
normally␈αif␈αit␈αhas␈αhappened.␈αIf␈αit␈αhasn't,␈αor␈αif␈αit's␈αa␈αnon-event,␈↓ α,
␈↓ α,␈β &␈↓␈↓ α,you␈α
get␈α
the␈α
error␈α
return␈α
with␈α
no␈α
waiting.␈↓ α,
␈↓ α,␈β D␈↓␈↓ α,
␈↓ α,␈β b␈↓␈↓ α,
␈↓ α,␈β
␈↓SETPRI PRI␈↓ α,
␈↓ α,␈β
≡␈↓␈↓ α,
␈↓ α,␈β
<␈↓␈↓ α,Sets␈αyour␈αpriority␈αto␈αPRI␈αor␈αthe␈αpriority␈αyou␈α
were␈α
originally␈α
run␈α
at,␈α
whichever␈α
is␈α
higher,␈α
and␈↓ α,
␈↓ α,␈β
Z␈↓␈↓ α,returns␈α∩your␈α∩old␈α∩priority␈α∩on␈α∩the␈α∩stack.␈α∩If␈α∩you␈α⊃attempted␈α⊃to␈α⊃set␈α⊃your␈α⊃priority␈α⊃below␈α⊃the␈↓ α,
␈↓ α,␈β
x␈↓␈↓ α,original,␈α
it␈α
returns␈α
C=1.␈↓ α,
␈↓ α,␈β⊗␈↓␈↓ α,
␈↓ α,␈β4␈↓␈↓ α,
␈↓ α,␈βR␈↓GETTIM (no args)␈↓ α,
␈↓ α,␈βp␈↓␈↓ α,
␈↓ α,␈β∞␈↓␈↓ α,Returns␈α⊂on␈α⊂your␈α⊂stack␈α∂the␈α∂time␈α∂in␈α∂milliseconds␈α∂since␈α∂the␈α∂Kernel␈α∂was␈α∂last␈α∂initialized.␈α∂The␈↓ α,
␈↓ α,␈β,␈↓␈↓ α,result␈α
is␈α
a␈α
two-word␈α
integer␈α
in␈α
the␈α
right␈α
format␈α
for␈α
a␈α
LDCLF␈α
or␈α
LDCLD␈α
instruction.␈↓ α,
␈↓ εW␈β∂l␈↓---6---